package com.ryskoo.catering.productspec.service;

import com.ryskoo.catering.productspec.domain.ProductSpecPO;
import com.ryskoo.catering.productspec.repository.IProductSpecRepository;
import com.ryskoo.framework.core.service.BasicServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.PostConstruct;
import java.util.List;

@Service
@Transactional
public class ProductSpecServiceImpl extends BasicServiceImpl<ProductSpecPO> implements IProductSpecService {

    @Autowired
    private IProductSpecRepository productSpecRepository;

    @PostConstruct
    public void init(){
        this.setDao(productSpecRepository);
    }

    @Override
    public void deleteByMainUuid(String mainUUid) {
        productSpecRepository.deleteByMainUuid(mainUUid);
    }

    @Override
    public List<ProductSpecPO> getSpecsByMainUuid(String mainUuid) {
        return productSpecRepository.getSpecsByMainUuid(mainUuid);
    }

    @Override
    public void deleteByMainUuids(List<String> mainUuids) {
        productSpecRepository.deleteByMainUuids(mainUuids);
    }
}
